package logic

import (
	"context"
	"short-video-manager/videorpc/videorpc"

	"short-video-manager/api/internal/svc"
	"short-video-manager/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type VidelDelLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewVidelDelLogic(ctx context.Context, svcCtx *svc.ServiceContext) *VidelDelLogic {
	return &VidelDelLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *VidelDelLogic) VidelDel(req *types.VidelDelRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	VideoDel, err := l.svcCtx.VideoRpc.VideoDel(l.ctx, &videorpc.VideoDelRequest{
		UserId:  req.UserId,
		VideoId: req.VideoId,
	})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Data:    nil,
			Code:    500,
		}, nil
	}
	return &types.Response{
		Message: "删除成功",
		Data:    VideoDel,
		Code:    200,
	}, nil
}
